package com.vp.org.test;

import com.vp.org.dao.BookDao;
import com.vp.org.dao.OrderDao;
import com.vp.org.dao.impl.BookDaoImpl;
import com.vp.org.dao.impl.OrderDaoImpl;
import com.vp.org.pojo.BookInfo;
import com.vp.org.pojo.Orders;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.List;

public class T {

    @Test
    void queryHot() {
        BookDao bookDao = new BookDaoImpl();
        System.out.println(bookDao.queryByHot());
    }

    @Test
    void queryCondition() {
        BookDao bookDao = new BookDaoImpl();
        BookInfo bookInfo = new BookInfo();
        bookInfo.setType("1");
        System.out.println(bookDao.queryByCondition(bookInfo));
    }

    @Test
    void queryDiscount() {
        BookDao bookDao = new BookDaoImpl();
        System.out.println(bookDao.queryByDiscount());
    }

    @Test
    void queryRemark() {
        BookDao bookDao = new BookDaoImpl();
        System.out.println(bookDao.queryRemarkById(12));
    }

    @Test
    void queryOrders() {
        OrderDao orderDao = new OrderDaoImpl();
        List<Orders> orders = orderDao.queryOrders(1);

        for (Orders order : orders) {
            System.out.println(order);
        }
    }

    @Test
    void file() {
        File file = new File("/upload/picture/123.jpg");

        try {
            //noinspection ResultOfMethodCallIgnored
            file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
